home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / ewl / ewl_fileselector.h < prev    next >
C/C++ Source or Header  |  2006-01-09  |  3KB  |  97 lines

  1. #ifndef __EWL_FILESELECTOR_H__
  2. #define __EWL_FILESELECTOR_H__
  3.  
  4. /**
  5.  * @file ewl_fileselector.h
  6.  * @defgroup Ewl_Fileselector Fileselector: Basic File And Directory Listing
  7.  *
  8.  * Displays a list of directories and a list of files for the user to choose.
  9.  * The selector triggers a EWL_CALLBACK_VALUE_CHANGED callback when either a
  10.  * click causes the selected file to change, when a double click causes the
  11.  * currently displayed directory to change, or when a double click on a file
  12.  * occurs to signal an open. The event data passed to the callback is NULL,
  13.  * unless the double click event occurred on a file, in which case it is the
  14.  * file's path.
  15.  *
  16.  * @{
  17.  */
  18.  
  19. /**
  20.  * @themekey /fileselector/file
  21.  * @themekey /fileselector/group
  22.  */
  23.  
  24. /**
  25.  * The Ewl_Fileselector provides a fileselector
  26.  */
  27. typedef struct Ewl_Fileselector Ewl_Fileselector;
  28.  
  29. /**
  30.  * @def EWL_FILESELECTOR(fd) 
  31.  * Typecasts a pointer to an Ewl_Fileselector pointer.
  32.  */
  33. #define EWL_FILESELECTOR(fs) ((Ewl_Fileselector *) fs)
  34.  
  35. /**
  36.  * @struct Ewl_Fileselector
  37.  * Creates a fileselector with one tree for dirs and one for files
  38.  */
  39. struct Ewl_Fileselector
  40. {
  41.     Ewl_Box        box;          /**< the box containing the widgets */
  42.     Ewl_Widget    *list_dirs;    /**< directory table */
  43.     Ewl_Widget    *list_files;   /**< file table */
  44.     Ewl_Widget    *entry_dir;    /**< current directory selected  */
  45.     Ewl_Widget    *entry_file;   /**< current file selected or typed */
  46.   
  47.     char          *path;         /**< current fileselector path */
  48.     Ecore_List    *files;        /**< current selection in fileselector */
  49.     char          *ffilter;      /**< current filter applied to files */
  50.     char          *dfilter;      /**< current filter for directories */
  51.     unsigned int   multi_select; /**< is the selector multi select or not */
  52. };
  53.  
  54. Ewl_Widget     *ewl_fileselector_new(void);
  55. int           ewl_fileselector_init(Ewl_Fileselector *fs);
  56.  
  57. char         *ewl_fileselector_path_get(Ewl_Fileselector *fs);
  58. char         *ewl_fileselector_file_get(Ewl_Fileselector *fs);
  59.  
  60. void          ewl_fileselector_path_set(Ewl_Fileselector *fs, const char *path);
  61.  
  62. void         ewl_fileselector_multiselect_set(Ewl_Fileselector *fs, 
  63.                             unsigned int val);
  64. unsigned int     ewl_fileselector_multiselect_get(Ewl_Fileselector *fs);
  65.  
  66. Ecore_List    *ewl_fileselector_select_list_get(Ewl_Fileselector *fs);
  67. void        ewl_fileselector_filter_set(Ewl_Fileselector *fs,
  68.                             char *filter);
  69.  
  70. /*
  71.  * Internally used callbacks, override at your own risk.
  72.  */
  73.  
  74. void ewl_fileselector_select_file_cb(Ewl_Widget *w, void *ev_data, void *data);
  75. void ewl_fileselector_select_dir_cb(Ewl_Widget *w, void *ev_data, void *data);
  76. void ewl_fileselector_go_up_cb(Ewl_Widget *w, void *ev_data, void *data);
  77. void ewl_fileselector_go_home_cb(Ewl_Widget *w, void *ev_data, void *data);
  78. void ewl_fileselector_filter_cb(Ewl_Widget *entry, void *ev_data, void *user_data);
  79.  
  80. /* Private: data for a file */
  81.  
  82. typedef struct Ewl_Fileselector_Data Ewl_Fileselector_Data;
  83. struct Ewl_Fileselector_Data
  84. {
  85.     char  *name; /* name of the file */
  86.     off_t  size; /* size of the file (bytes) */
  87.     time_t time; /* last modification */
  88.     mode_t mode; /* mode of the file (permissions) */
  89. };
  90.  
  91. Ewl_Fileselector_Data *ewl_fileselector_data_new(const char *name, off_t  size,
  92.                                time_t time, mode_t mode);
  93. void ewl_fileselector_data_free(Ewl_Fileselector_Data *d);
  94.  
  95. #endif /* __EWL_FILESELECTOR_H__ */
  96.  
  97.